<?php
// +----------------------------------------------------------------------
// | 幕小铺
// +----------------------------------------------------------------------
// | 版权所有 2016~2020 幕小铺科技（大连）有限公司
// +----------------------------------------------------------------------
// | 2020/03/14
// +----------------------------------------------------------------------

namespace app\user_center\validate\member;

use think\Validate;

/**
 * 公共类 验证器 认证信息验证
 * @package app\admin\validate
 * @author jason wang <120907037@qq.com>
 */
class Authentication extends Validate
{
    protected $rule = [
        'user_id'       			=>  'number|require|gt:0|behavior:\app\user_center\behavior\common\checkUserId', 	 //user_id 数字/必填/大于0
		'certifi_'					=>  'number|require|gt:0',// 1企业 2个人
		'classification_id'			=>  'number|require|gt:0',
		'business_license_url'		=>  'require',
		'certification_letter_url'	=>  'require',
		'certifi_name'				=>  'chsDash|require',
		'certification_information' =>  'chsDash|require|length:1,16',
		'operator_name' 			=>  'require',
		'operator_mobile' 			=>  'require|mobile',
		'operator_code' 			=>  'number|require|gt:0|length:4', //验证码
		'operator_email' 			=>  'email',
		'invoice_email' 			=>  'email',
    ];

    protected $message  =   [
        'user_id' 					=> 'user_id格式错误',
        'certifi_type' 				=> 'type格式错误',
        'classification_id'			=> '行业id格式错误',
        'business_license_url'		=> '企业资质格式错误',
        'certification_letter_url'	=> '公函模板格式错误',
        'certifi_name'				=> '用户名格式错误',
        'certification_information'	=> '认证信息格式错误',
        'operator_name' 			=> '联系人姓名格式错误',
        'operator_mobile' 			=> '联系人手机号格式错误',
        'operator_code' 			=> '验证码格式错误',
        'operator_email' 			=> '管理者邮箱格式错误',
        'invoice_email' 			=> '发票接收邮箱格式错误',
    ];

    //验证场景
    protected $scene = [
        					'add_titlecertification'=>  [//认证头衔
														'user_id',
														'certifi_type',
														'classification_id',
														'business_license_url',
														'certification_letter_url',
														'certifi_name',
														'certification_information',
														'operator_name',
														'operator_mobile',
														'operator_code',
														'operator_email',
														'invoice_email',
													],
							'get_titlecertification'=>  [//认证头衔
														'user_id',
													]
               			];
}
